﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;
using System.Configuration;

namespace HAINGUYEN_HOTEL.Helper
{
    public class Helper
    {
        public static readonly String PayPal_Url = ConfigurationManager.AppSettings["PayPalSubmitUrl"];
        public static readonly String PayPal_UserName = ConfigurationManager.AppSettings["PayPalUsername"];
        public static readonly String PayPal_SuccessUrl = ConfigurationManager.AppSettings["PayPalSuccessUrl"];
        public static readonly Decimal CurrenToUSD =Decimal.Parse(ConfigurationManager.AppSettings["CurrenceUSD"].ToString());
        public static void BindDropDownList(DropDownList dropDownList, object dataSource, string dataTextField, string dataValueField, bool addFirstItem)
        {
            if (dataSource == null) return;

            dropDownList.DataTextField = dataTextField;
            dropDownList.DataValueField = dataValueField;
            dropDownList.DataSource = dataSource;
            dropDownList.DataBind();

            if (!addFirstItem) return;

            var _arrSort = new ListItem[dropDownList.Items.Count + 1];
            _arrSort[0] = new ListItem("Tất cả", "%");
            for (var _li = 0; _li < _arrSort.Length - 1; _li++) { _arrSort[_li + 1] = dropDownList.Items[_li]; }
            dropDownList.Items.Clear();
            dropDownList.Items.AddRange(_arrSort);
        }
    }
    public class SessionKey
    {
        public const string MyRoom = "MyRoom";
        public const string MyCart = "MyCart";
        public const string MyRoomChecking = "MyRoomChecking";
        public const string MyCartChecking = "MyCartChecking";
    }
}